<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
  function agepoint() {
    var voteable, demo;
    demo = document.getElementById("age").value;
    voteable = (demo > 18) ? "您有资格参加" : "您还未成年没有资格参加";
    document.getElementById("p1").innerHTML = voteable;
  }
</script>
<body>
<h1>请输入你的成绩</h1>
<input id="age" value="18">
<button onclick="agepoint()">点击查看资格</button>
<p id="p1"></p>
</body>
</html>
